package org.jinghouyu.caculator.engine;

import org.jinghouyu.caculator.engine.node.NodeParser;

/**
 * 程序入口
 * @author liujingyu
 *
 */
public class ExpressionParser {
	
	private static Expression parse(String exp, ExpressionContext context) {
		return NodeParser.parse(exp, context);
	}
	
	public static Object caculate(String exp, ExpressionContext context) {
		context = context == null ? new ExpressionContext() : context;
		return parse(exp, context).caculate();
	}
	
	public static Object caculate(String exp) {
		return caculate(exp, null);
	}
}